home *** CD-ROM | disk | FTP | other *** search
/ Sprite 1984 - 1993 / Sprite 1984 - 1993.iso / man / lib.fmt / c / chmod.man < prev    next >
Encoding:
Text File  |  1991-02-17  |  4.1 KB  |  133 lines

  1.  
  2.  
  3.  
  4. CHMOD                 C Library Procedures                  CHMOD
  5.  
  6.  
  7.  
  8. NNAAMMEE
  9.      chmod, fchmod - change mode of file
  10.  
  11. SSYYNNOOPPSSIISS
  12.      cchhmmoodd((ppaatthh,, mmooddee))
  13.      cchhaarr **ppaatthh;;
  14.      iinntt mmooddee;;
  15.  
  16.      ffcchhmmoodd((ffdd,, mmooddee))
  17.      iinntt ffdd,, mmooddee;;
  18.  
  19. DDEESSCCRRIIPPTTIIOONN
  20.      The file whose name is given by _p_a_t_h or referenced by the
  21.      descriptor _f_d has its mode changed to _m_o_d_e.  Modes are con-
  22.      structed by _o_r'ing together some combination of the follow-
  23.      ing, defined in <_s_y_s/_s_t_a_t._h>:
  24.  
  25.           S_ISUID   04000   set user ID on execution
  26.           S_ISGID   02000   set group ID on execution
  27.           S_ISVTX   01000   `sticky bit' (see below)
  28.           S_IREAD   00400   read by owner
  29.           S_IWRITE  00200   write by owner
  30.           S_IEXEC   00100   execute (search on directory) by owner
  31.                     00070   read, write, execute (search) by group
  32.                     00007   read, write, execute (search) by others
  33.  
  34.      If an executable file is set up for sharing (this is the
  35.      default) then mode S_ISVTX (the `sticky bit') prevents the
  36.      system from abandoning the swap-space image of the program-
  37.      text portion of the file when its last user terminates.
  38.      Ability to set this bit on executable files is restricted to
  39.      the super-user.
  40.  
  41.      If mode S_ISVTX (the `sticky bit') is set on a directory, an
  42.      unprivileged user may not delete or rename files of other
  43.      users in that directory.  For more details of the properties
  44.      of the sticky bit, see _s_t_i_c_k_y(8).
  45.  
  46.      Only the owner of a file (or the super-user) may change the
  47.      mode.
  48.  
  49.      Writing or changing the owner of a file turns off the set-
  50.      user-id and set-group-id bits unless the user is the super-
  51.      user.  This makes the system somewhat more secure by pro-
  52.      tecting set-user-id (set-group-id) files from remaining
  53.      set-user-id (set-group-id) if they are modified, at the
  54.      expense of a degree of compatibility.
  55.  
  56. RREETTUURRNN VVAALLUUEE
  57.      Upon successful completion, a value of 0 is returned.  Oth-
  58.      erwise, a value of -1 is returned and _e_r_r_n_o is set to indi-
  59.      cate the error.
  60.  
  61.  
  62.  
  63. Sprite v1.0               May 13, 1986                          1
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70. CHMOD                 C Library Procedures                  CHMOD
  71.  
  72.  
  73.  
  74. EERRRROORRSS
  75.      _C_h_m_o_d will fail and the file mode will be unchanged if:
  76.  
  77.      [ENOTDIR]      A component of the path prefix is not a
  78.                     directory.
  79.  
  80.      [EINVAL]       The pathname contains a character with the
  81.                     high-order bit set.
  82.  
  83.      [ENAMETOOLONG] A component of a pathname exceeded 255 char-
  84.                     acters, or an entire path name exceeded 1023
  85.                     characters.
  86.  
  87.      [ENOENT]       The named file does not exist.
  88.  
  89.      [EACCES]       Search permission is denied for a component
  90.                     of the path prefix.
  91.  
  92.      [ELOOP]        Too many symbolic links were encountered in
  93.                     translating the pathname.
  94.  
  95.      [EPERM]        The effective user ID does not match the
  96.                     owner of the file and the effective user ID
  97.                     is not the super-user.
  98.  
  99.      [EROFS]        The named file resides on a read-only file
  100.                     system.
  101.  
  102.      [EFAULT]       _P_a_t_h points outside the process's allocated
  103.                     address space.
  104.  
  105.      [EIO]          An I/O error occurred while reading from or
  106.                     writing to the file system.
  107.  
  108.      _F_c_h_m_o_d will fail if:
  109.  
  110.      [EBADF]        The descriptor is not valid.
  111.  
  112.      [EINVAL]       _F_d refers to a socket, not to a file.
  113.  
  114.      [EROFS]        The file resides on a read-only file system.
  115.  
  116.      [EIO]          An I/O error occurred while reading from or
  117.                     writing to the file system.
  118.  
  119. SSEEEE AALLSSOO
  120.      chmod(1), open(2), chown(2), stat(2), sticky(8)
  121.  
  122.  
  123.  
  124.  
  125.  
  126.  
  127.  
  128.  
  129. Sprite v1.0               May 13, 1986                          2
  130.  
  131.  
  132.  
  133.